﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Image2d
{
    
    
    class ColissionManager
    {
        List<Shot> shots;
        public List<Shot> Shots
        {
            get { return shots; }
            set { shots = value; }
        }
        List<Asteroids> asteroids;
        public List<Asteroids> Asteroides
        {
            get { return asteroids; }
            set { asteroids = value; }
        }

        Rectangle playerColider;
        Rectangle asteroidColider;
        Rectangle shotColider;

        public ColissionManager()
        {

        }

        public void Update(GameTime gameTime, Player player, List<Asteroids> asteroids)
        {
            shots = player.shots.Shots;
            this.asteroids = asteroids;

            playerColider = new Rectangle((int)player.Position.X, (int)player.Position.Y, (int)player.Rect.Width, (int)player.Rect.Height);

            for( int i = 0; i < asteroids.Count; i++)
            {
                //setar o colider do asteroid i


                //verifica se o asteroi i atingiu a nave
                if (playerColider.Intersects(asteroidColider))
                {
                    //um aerolito atingiu a nave
                    Console.WriteLine(player.Rect.Width);
                    Console.WriteLine("DAMAGE TAKEN");
                }
            }


            /*
             *   rect = new Rectangle((int)currentAnimation.startPosition.X, 
             *   (int)currentAnimation.startPosition.Y,
             *   (int)currentAnimation.frameSize.X, 
             *   (int)currentAnimation.frameSize.Y);
             */
        }

    }


}
